﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;
using Microsoft.SharePoint;

namespace VH.SharePoint.Api.Controls
{
    public class RsdLinksControl : WebControl
    {
        private const string RsdLinkFomat = "<link rel=\"EditURI\" type=\"application/rsd+xml\" title=\"RSD\" href=\"{0}\" />";
        private const string WlwManifestLikFormat = "<link rel=\"wlwmanifest\" type=\"application/wlwmanifest+xml\" href=\"{0}\" /> ";
        private BlogWeb _blog;
        protected override void OnLoad(EventArgs e)
        {
            _blog = BlogWeb.GetBlogWeb(SPContext.Current.Web);
        }
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            if (_blog.IsEnabled)
            {
                writer.WriteLine(RsdLinkFomat, _blog.Web.Url + SPConstants.EndPointRsd);
                writer.WriteLine(WlwManifestLikFormat, _blog.Web.Url + SPConstants.EndPointWlwManifest);
            }
        }
    }
}
